package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyNetworkBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class NetworkAdapter extends StkProviderMultiAdapter<MyNetworkBean> {

    public NetworkAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(66));
        addItemProvider(new NetworkProvider());
    }

    private class NetworkProvider extends BaseItemProvider<MyNetworkBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_network;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyNetworkBean bean) {
            baseViewHolder.setImageResource(R.id.ivNetworkItemImg, bean.getImg());
            baseViewHolder.setText(R.id.tvNetworkItemName, bean.getName());
        }
    }
}
